<?php
require_once './../class/MonthlyReport.inc';
$id = $_POST ['id'];
$date = $_POST ['date'];

$monthlyReport = new MonthlyReport ();
$monthlyReport->search4Detail ( $id, $date );
$month= explode("/", $date);

if ($monthlyReport->mem_id == null || empty ( $monthlyReport->mem_id )) {
	echo "조회하신 ".$month[1]."월 결산이 완료되지 않아 조회할 데이터가 없습니다.";
	exit ();
} else {
	echo "<thead> <tr class='tr_head'><th colspan='10'>결산정보</th></tr>";
	echo "<tr> <th>사원번호</th> <th>성명</th> <th>차량번호</th><th>소유구분</th><th>지급은행</th><th>예금주명</th><th colspan='2'>계좌번호</th><th>지급일</th><th>지급액</th></tr></thead>";
	echo "<tbody><tr><td>";
	echo $monthlyReport->mem_id;
	echo "</td><td>";
	echo $monthlyReport->name;
	echo "</td><td>";
	echo $monthlyReport->car_id;
	echo "</td><td>";
	echo $monthlyReport->soyu_tp;
	echo "</td><td>";
	echo $monthlyReport->bank_nm;
	echo "</td><td>";
	echo $monthlyReport->act_nm;
	echo "</td><td colspan='2'>";
	$monthlyReport->actno;
	echo "</td><td>";
	echo $monthlyReport->sply_dt;
	echo "</td><td>";
	echo number_format ( $monthlyReport->sply_amt );
	echo "</td></tr></tbody>";
	
	echo "</table><table class='table table-bordered'><thead><tr class='tr_head'><th colspan='10'>운송료</th></tr>";
	echo "<tr><th>기본 운송료</th><th>통신비</th><th>세차비</th><th>만근지원비</th><th>운행장려금</th><th>용차비</th><th>운송료추가</th><th>기타</th><th>기타2</th></tr></thead>";
	echo "<tbody><tr><td>";
	echo number_format ( $monthlyReport->fare_amt );
	echo "</td><td>";
	echo number_format ( $monthlyReport->comm_exp );
	echo "</td><td>";
	echo number_format ( $monthlyReport->car_wash_exp );
	echo "</td><td>";
	echo number_format ( $monthlyReport->attend_exp );
	echo "</td><td>";
	echo number_format ( $monthlyReport->incen_pay );
	echo "</td><td>";
	echo number_format ( $monthlyReport->dil_van_exp );
	echo "</td><td>";
	echo number_format ( $monthlyReport->apd_dil_exp );
	echo "</td><td>";
	echo number_format ( $monthlyReport->dil_etc_exp );
	echo "</td><td>";
	echo number_format ( $monthlyReport->receipt_exp );
	echo "</td></tr><tr><td>운송료 합계:</td><td colspan='10'>";
	echo number_format ( $monthlyReport->tot_dil_amt );
	echo "</td></tr></tbody></table>";
	echo "<table class='table table-bordered'><thead><tr class='tr_head'><th colspan='10'>공제</th></tr>";
	echo "<tr><th>관리비</th><th>부가세</th><th>보험료</th><th>회차</th><th>환경개선비/협회비</th><th>자동차세</th><th>GPS</th><th>과태료</th><th>사고접보비</th><th>유류연비차액</th></tr></thead>";
	echo "<tbody><tr><td>";
	echo number_format ( $monthlyReport->mngt_exp );
	echo "</td><td>";
	echo number_format ( $monthlyReport->surtax );
	echo "</td><td>";
	echo number_format ( $monthlyReport->insu_fee );
	echo "</td><td>";
	echo number_format ( $monthlyReport->insu_deg );
	echo "</td><td>";
	echo number_format ( $monthlyReport->commit_fee );
	echo "</td><td>";
	echo number_format ( $monthlyReport->car_tax );
	echo "</td><td>";
	echo number_format ( $monthlyReport->gps_fee );
	echo "</td><td>";
	echo number_format ( $monthlyReport->fine_fee );
	echo "</td><td>";
	echo number_format ( $monthlyReport->acct_fee );
	echo "</td><td>";
	echo number_format ( $monthlyReport->mileage_fee );
	echo "</td></tr></tbody>";
	echo "<thead><tr><th>출퇴근유류비</th><th>차량할부</th><th>할부회차</th><th>예치금</th><th>선지급</th><th>기장료</th><th>이체수수료</th><th>도색비</th><th>기타</th><th>사업소득세</th></tr></thead><tbody>";
	echo "<tr><td>";
	echo number_format ( $monthlyReport->commute_oil_fee );
	echo "</td><td>";
	echo number_format ( $monthlyReport->instl_fee );
	echo "</td><td>";
	echo number_format ( $monthlyReport->instl_deg );
	echo "</td><td>";
	echo number_format ( $monthlyReport->deposit );
	echo "</td><td>";
	echo number_format ( $monthlyReport->ada_pay );
	echo "</td><td>";
	echo number_format ( $monthlyReport->account_fee );
	echo "</td><td>";
	echo number_format ( $monthlyReport->trans_fee );
	echo "</td><td>";
	echo number_format ( $monthlyReport->paint_exp );
	echo "</td><td>";
	echo number_format ( $monthlyReport->charoff_etc_fee );
	echo "</td><td>";
	echo number_format ( $monthlyReport->incm_tax );
	echo "</td></tr><tr><td>공제 합계:</td><td colspan='9'>";
	echo number_format ( $monthlyReport->tot_dedt_amt );
	echo "</td></tr></tbody></table>";
	
	echo "<table class='table table-bordered'><thead><tr class='tr_head'><th colspan='10'>공지사항</th></tr></thead><tbody><tr><td colspan='10'>";
	echo "<textarea id='notice' name='notice' type='text' class='form-control' rows='10' cols='50' readonly='readonly'>";
	echo $monthlyReport->notice;
	echo "</textarea></td></tr></tbody>";
	
	echo "<thead><tr class='tr_head'><th colspan='11'>비고</th></tr></thead>";
	echo "<tbody><tr><td colspan='11'>";
	echo "<textarea id='etc_text' name='etc_text' type='text' class='form-control' rows='10' cols='50'  readonly='readonly'>";
	echo $monthlyReport->notice;
	echo "</textarea></td></tr></tbody>";
	echo "</table>";
	
}
?>